package 网络编程;

import java.io.IOException;
import java.util.HashMap;

public class UdpDictServer extends UdpEchoServer{
    private HashMap<String,String> dict=new HashMap<>();
    public UdpDictServer(int port) throws IOException {
        super(port);
        dict.put("cat","小猫");
        dict.put("dog","小狗");

    }
    public String process(String request){
        return dict.getOrDefault(request,"该词无法被查询");
    }

    public static void main(String[] args) throws IOException {
        UdpDictServer server=new UdpDictServer(9090);
        server.start();
    }

}
